package com.linzm.creationaltype.abstractfactory02.factory;

import com.linzm.creationaltype.abstractfactory02.Color.Color;
import com.linzm.creationaltype.abstractfactory02.Shape.Shape;
import com.linzm.creationaltype.abstractfactory02.enums.ColorTypeEnum;
import com.linzm.creationaltype.abstractfactory02.enums.TypeInterface;

/**
 * @Author zimingl
 * @Date 2023/4/15 19:35
 * @Description: ColorFactory
 */
public class ColorFactory extends AbstractFactory {
    @Override
    public Shape getShape(String shapeType) {
        return null;
    }

    @Override
    public Color getColor(String color) throws Exception {
        TypeInterface shapeTypeEnum = ColorTypeEnum.valueOf(color);
        Class<?> clazz = shapeTypeEnum.getClazz();
        return (Color) clazz.newInstance();
    }
}
